<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D练习</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background-color: yellowgreen;
            float: left;
            margin-right: 100px;
            text-align: center;
            line-height: 200px;
        }
        body {
            transform-style:preserve-3d ;
            perspective: 2000px;
        }
        .box1 {
            transition: 0.2s linear;
        }
        .box1:hover {
            transform: translateZ(50px);
        }
        .box3:hover {
            transform: rotateY(40deg);
        }
    </style>
</head>
<body>
    <div class="box box1">位移</div>
    <div class="box box3">旋转</div>
</body>
</html>